import Vue from 'vue'

const filters =  {
	stringLength(string, number){
		if (string.length > number) {
			return string.slice(0,number) +'.'
		}else{
			return string
		}
	},
	filtrationDate(time){
		if (time) {
			return time.replace(/(^[\d]{4}.[\d]{2}.[\d]{2})(\s.*)/, '$1')
		}
	},
	analysisStatus(state){
		let data = state-0
		switch(data){
			case 1:
			return '待服务'
			break;
			case 2:
			return '服务中'
			break;
			case 3:
			return '以服务'
			break;
			case 4:
			return '退单中'
			break;
			case 5:
			return '已退单'
			break;
		}
	}
}
for (let i in  filters) {
	Vue.filter(i, filters[i])
}

